package com.sunwoda.demo.controller;


import com.sunwoda.demo.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.IncorrectCredentialsException;
import org.apache.shiro.authc.UnknownAccountException;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.subject.Subject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;


/**
 * (User)表控制层
 *
 * @author makejava
 * @since 2021-03-17 15:13:03
 */
@Controller
@RequestMapping("user")
@Slf4j
public class UserController {
    /**
     * 服务对象
     */
    @Resource
    private UserService userService;

    /**
     * @return
     * @Author shiguorang
     * @Description //登录
     * @Date 15:38:24 2021-03-17
     * @Param
     **/
    @PostMapping(value = "/login")
    public String login(String userName, String password) {
        String url = userService.login(userName, password);
        return url;
    }

    /**
     * @return
     * @Author shiguorang
     * @Description // 提出系统
     * @Date 19:25:13 2021-03-17
     * @Param
     **/
    @GetMapping(value = "/logout")
    public String logout() {
        String url = userService.logout();
        return url;
    }

    /**
     * @return
     * @Author shiguorang
     * @Description //注册
     * @Date 19:31:52 2021-03-17
     * @Param
     **/
    @PostMapping(value = "/registered")
    public String registered(String userName, String password) {
        String url = userService.registered(userName, password);
        return url;
    }

}
